package com.vhall.component.plugin.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author jingwen.li
 */
@Getter
@AllArgsConstructor
public enum GoodsPrdTypeEnum {
    DEFAULT(0, ""),
    PROD_TYPE_1(1, "VIP资讯"),
    PROD_TYPE_2(2, "策略工具"),
    PROD_TYPE_3(3, "基金投顾策略"),
    PROD_TYPE_4(4, "鑫汇盈"),
    PROD_TYPE_5(5, "组合"),
    PROD_TYPE_6(6, "ETF"),
    PROD_TYPE_7(7, "公募基金");

    private final Integer code;

    private final String name;

    public static String getName(Integer code) {
        GoodsPrdTypeEnum parse = parse(code);
        if (parse != null) {
            return parse.getName();
        }
        return StringUtils.EMPTY;
    }

    public static GoodsPrdTypeEnum parse(Integer code) {
        for (GoodsPrdTypeEnum anEnum : GoodsPrdTypeEnum.values()) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return DEFAULT;
    }
}
